<?php

class m110801_012833_customer_address_log extends CDbMigration
{
	public function safeUp()
	{
		$this->createTable('dycrm_customer_address_log', array(
			'id'=>'pk',
			'customerId'=>'integer',
			'postalAddress'=>'string',
			'postalSuburb'=>'string',
			'postalPostcode'=>'string',
			'postalState'=>'string',
			'postalCountry'=>'string',
			'changeDate'=>'datetime',
			'changeUserId'=>'integer',
		));
		$this->addForeignKey('customer_address_log_fk_customer', 
		'dycrm_customer_address_log', 'customerId', 'dycrm_customer', 'id','CASCADE','CASCADE');
		$this->addForeignKey('customer_address_log_fk_change_user', 
		'dycrm_customer_address_log', 'changeUserId', 'dycrm_user', 'id','CASCADE','CASCADE');
		
	}

	public function safeDown()
	{
		$this->dropTable('dycrm_customer_address_log');
	}
}